﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>消息中心</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/JqueryPlug/dtGrid/jquery.dtGrid.css" rel="stylesheet">
    <link href="/CSS/Base/BaseClass.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script type="text/javascript" src="/JqueryPlug/layer/layer/layer.js"></script>
    <script src="/Scripts/SZHLCommon.js"></script>
    <script src="/JqueryPlug/dtGrid/jquery.dtGrid.js"></script>
    <style type="text/css">
        table tbody tr td i {
            cursor: pointer;
        }
    </style>
    <script>

        var model = avalon.define({
            $id: "CommonData",
            CommonData: [],
            SearchContent: "",
            GetXXZXDataList: function (msgType) {
                parent.ComFunJS.winload();
                $.getJSON('/API/FTAPI.ashx?Action=GETXXZXIST', { P1: msgType, P2: model.SearchContent }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.CommonData = resultData.Result;
                    }
                    parent.ComFunJS.wincloseload();
                })

            }, ReadXX: function (item, dom, status) {
                var type = "";
                if (item == null) {
                    type = "ALL";
                }
                $.post("/API/FTAPI.ashx", { Action: "UPDTEREADSTATES", P1: item == null ? "" : item.ID, P2: type, s:status }, function (result) {
                    var jsonresult = $.parseJSON(result)
                    if ($.trim(jsonresult.ErrorMsg) != "") {
                        ComFunJS.winwarning(jsonresult.ErrorMsg);
                    } else {
                        if (type == "ALL") {
                            $(".fa").removeClass("fa-square-o").addClass("fa-check-square-o");
                        } else {
                            var removeClass = "fa-square-o";
                            var addCla = "fa-check-square-o";
                            if (status == 'N') {
                                $(dom).removeClass(addCla).addClass(removeClass)
                            } else {
                                $(dom).removeClass(removeClass).addClass(addCla)
                            }

                        }
                    }
                })
            }
        });
        avalon.ready(function () {
            model.GetXXZXDataList("N");
        })


    </script>
</head>
<body ms-controller="CommonData">
    <div class="container-fluid maindiv" style="margin-top: 20px" id="dvContent">
        <div style="width:120px;position:absolute">
            <table class="table table-bordered  menutab" style="margin:0;">
                <tr ms-click="GetXXZXDataList('N')">
                    <td class="sycd sycdactive">
                        <div><i class="fa fa-envelope hvr-grow "></i></div>
                        <div><strong>未读消息</strong> </div>
                    </td>
                </tr>
                <tr ms-click="GetXXZXDataList('Y')">
                    <td class="sycd">
                        <div><i class="fa fa-envelope hvr-grow "></i></div>
                        <div><strong>已读消息</strong>  </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="row contentdv" style="margin-left:121px">
            <div class="col-xs-12 ">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-xs-6">
                                <span class="label label-info " style="cursor:pointer" ms-click="ReadXX(null,null,null)">标记所有消息为已读</span>
                            </div>
                            <div class="col-xs-3">
                            </div>
                            <div class="col-xs-3">
                            </div>
                        </div>
                    </div>
                    <table class="table table-bordered table-hover table-striped">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th style="width:120px">消息类别</th>
                                <th style="width:70%">内容</th>
                                <th>时间</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ms-repeat-item="CommonData">
                                <td><i ms-click="ReadXX(item,this,item.isRead=='N'?'Y':'N')" class="fa" ms-class-1="fa-square-o:item.isRead=='N'" ms-class-2="fa-check-square-o:item.isRead=='Y'"></i></td>
                                <td>{{item.MsgType}}</td>
                                <td>{{item.MsgContent}}</td>
                                <td>{{item.CRDate|date("yyyy-MM-dd")}}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
</body>
</html>
